# 定义一个英雄类，此英雄类需要包含 姓名、 血量、 攻击力、 还需要有一个方法为讲台词。
class Hero:
    def __init__(self, name, hp, power):
        self.name = name
        self.hp = hp
        self.power = power

    def speck(self):
        print(f"我叫{self.name} 我的血量{self.hp},欢迎")


class Master(Hero):
    def __init__(self, name, hp, power, magic):
        super().__init__(name, hp, power)
        self.magic = magic

    def speck(self):
        super().speck()

    def show_magic(self):
        if self.magic < 50:
            print("没蓝了")
        else:
            print(f"{self.name}在释放技能")
            self.magic -= 50


class Soldier(Hero):
    def __init__(self, name, hp, power, armor):
        super().__init__(name, hp, power)
        self.armor = armor


def fight(hero1: Hero, hero2: Hero):
    hero1.speck()
    hero2.speck()
    hero1_hp = hero1.hp
    hero2_hp = hero2.hp
    hero1_name = hero1.name
    hero2_name = hero2.name
    hero1_power = hero1.power
    hero2_power = hero2.power

    while True:
        hero1_hp -= hero2_power
        hero2_hp -= hero1_power
        if hero1_hp <= 0 or hero2_hp <= 0:
            if hero1_hp > hero2_hp:
                print(f"英雄{hero1_name}赢了")
                return hero1_name
            elif hero1_hp < hero2_hp:
                print("英雄赢了", hero2_name)
                return hero2_name
            else:
                return "平局"


if __name__ == '__main__':
    hero = Hero("jinx", 1000, 70)

    hero.speck()

    wj = Master("维嘉", 1000, 60, 100)
    wj.speck()

    fight(hero, wj)
